package com.csxy.yhj.controller;

import com.csxy.yhj.service.OssService;
import com.csxy.yhj.yhj.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
//@Service
@Tag(name = "oss", description = "阿里云oss接口")
@RestController
@RequestMapping("/edu_oss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;

    @Operation(summary = "上传图片")
    @RequestMapping("/upload")
    public R uploadFile(@RequestParam(name = "file") MultipartFile file) {
        String url = ossService.uploadFileAvatar(file);
        return R.ok().data("url", url).message("文件上传成功");
    }
}